perm filename SAVE2[F8,ALS]1 blob
sn#313717 filedate 1977-11-04 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00009 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 *CHECKERS as of November 4 1977. EQU's
C00008 00003 ORG H'1800' SELE JUMP
C00024 00004 * NORM FORE
C00035 00005 * RASC SCRA FKT STMV
C00041 00006 * NEXT FIND RFJ LFJ RBJ LBJ
C00059 00007 * AFT MAKE RFN LFN RBN LBN NORT NORF NOR2 NOR3 NOR4
C00071 00008 * EVAL
C00078 00009 * EMPT CAQ MPYR WAST
C00086 ENDMK
C⊗;
*CHECKERS as of November 4 1977. EQU's
* S2 section
*Resident package addresses
JOYT EQU H'0C00'
LINE EQU H'0FDF'
SHCB EQU H'0FE2'
INPF EQU H'0FE3'
WTLN EQU H'0FE5'
TXC EQU H'0FE8'
CMRG EQU H'0FEA'
DBNC EQU H'0FEB'
UPI EQU H'0FFA'
JOYI EQU H'21AD'
IJS EQU H'22DB'
SHL EQU H'27C6'
SHR EQU H'27D3'
PUSH EQU H'40A9'
POPS EQU H'40BC'
SPS EQU H'40D0'
WDG EQU H'4105'
WAUD EQU H'41C8'
WAU1 EQU H'41CC'
CDS EQU H'41D5'
WMS EQU H'4205'
UDAT EQU H'424D'
TRAN EQU H'43CD'
FCS EQU H'43D6'
WAIT EQU H'4501'
TIR EQU H'45DB'
CLER EQU H'4762'
*Misc. constants
TCMD EQU H'44'
BCMD EQU H'6D'
TCOL EQU H'80' TEXT COLOR
ULIN EQU H'F5'
COM EQU H'8F7'
*
*RAM assignments
BFLG EQU H'0C20'
BLNF EQU H'0C21' Blink flag
XBLN EQU H'0C22' X value to blink
YBLN EQU H'0C23' Y value to blink
BCNT EQU H'0C24' Counter used in OKMV
BKMV EQU H'0C25' Data to index book moves
HSAV EQU H'0C26' H save location
PLY0 EQU H'0C28' Players choice of ply depth
COL0 EQU H'0C29' 0 if machine plays black
SELX EQU H'0C2A' Move count
OBJ0 EQU H'0C30' Board 1, thru H'0E0F'
TREE EQU H'0E10' Tree data, thru H'0EFF', Player's board first
TRE2 EQU H'0E20' Machine's first board here
TRE3 EQU H'0E30' PLY 1 location
PLMD EQU H'0E5B' Used for temp store of player's move inf
PLMV EQU H'0ED0' Overlay region used for player's moves
PLMF EQU H'0EE0' and move numbers
SCOR EQU H'0EF0' 28 bytes for scores
XPOS EQU H'0F0C' XPOSITION(CURSOR)
YPOS EQU H'0F0F' YPOSITION(CURSOR)
OBJ1 EQU H'0F10' Board 2, thru H'0FAF'
MOBS EQU H'0FB0' Mobility and DJ flags (14 bytes)
RGSV EQU H'0FC1' Register save start (int. update)
*
*Scratch pad assignments
TEMP EQU H'8'
J EQU H'9'
HU EQU H'A'
HL EQU H'B'
PLOC EQU O'3' LISU value for ACTIVE and PASSIVE
KLOC EQU O'4' LISU value for KING's and special data
ELOC EQU O'5' LISU value for EMPTY's area
ISA EQU O'30' ISAR value for active area
ISP EQU O'34' ISAR value for passive
ISK EQU O'40' ISAR value for kings
ACTM EQU O'46' Location of Active material count
PASM EQU O'47' Location of Passive material count
ISE0 EQU O'50' ISAR value for guard byte
ISE EQU O'51' ISAR value foempty (with offset)
*Mimimum ply depths
PLYT EQU H'FE' Ply depth for Robot Tom (stored as neg.)
PLYD EQU H'FD' Ply depth for Robot Dick
PLYH EQU H'FC' Ply depth for Robot Harry
*SPECIAL CONSTANTS
X EQU H'1'
Y EQU H'2'
VX EQU H'3'
VY EQU H'4'
CHT EQU H'3' CURSOR HEIGHT
YTST EQU H'9'
XZOP EQU H'34' Line for restorre of X zoom
MAXY EQU H'4D' MAX Y COORD (=H'4F'-CHT)
*Linkage locations
PMOV EQU H'1100' Player's move
WMC EQU H'1200' Write message
BORD EQU H'1300' Normal redo of board
SHOW EQU H'1780' Debugging aid to show board
ORG H'1800' SELE JUMP
*-*-*-
SELE PI SHOW
PI WAST Debugging show board
LISU PLOC
LISL 0
LR DC,H
LIS H'C' To get MOVE byte
ADC
LM
LR 0,A Save it temporarily
NS 0 To set status byte
BNZ SEL3
JMP NEXT To get next MOVE byte
SEL3 LI H'FF'
ADC Get back to move byte
LR A,0
AI H'FF' Really subtracting 1
NS 0 Remove right-most on-bit
ST Put remaining bits back (and index)
XS 0 This gets the extracted bit
LR 6,A Save it in 6
LM Now get the byte designation
SEL4 LR 5,A
SR 1
SR 1
NI H'3' Separate the byte indicator part
LR 4,A Save it in 4
LR A,5
NI H'13' Separate the JUMP bit and the direction
LR 5,A Save them in 5
DELE LI ISA Process Active and Kings for source deletion
AS 4 Add byte #
LR IS,A Get to initial byte
LR A,S
LR 3,A
XS 6 Delete moving piece
LR S,A from byte
LISU KLOC To get to corresponding KING byte
LR A,S
NS 6 Was the piece a king?
BZ DEL2
XS S If it was delete king bit
LR S,A
LIS H'7' Non-zero in 2 for king
DEL2 LR 2,A 0 for man, 7 for king, (later 1 for promotion)
LISU PLOC Back to active section
*Now locate captured piece if jump or find destination in normal move
LR A,6 Recall MOVE bit
SR 4
BZ INRH Bit was in right half of byte
INLH LR 3,A Save partially shifted MOVE bit
LR A,5 Get direction
NI H'1' To test right-most bit
BZ INL2 RF or LB move where 4 shift is correct
LR A,3
SR 1 LF and LB require an additional shift
LR 3,A
INL2 LR A,5 Now test for fore or aft
NI H'2'
BZ BOTH Forward move, no byte shift needed
LR A,D Only to decrement ISAR
INL3 BR BOTH
*
INRH LR A,6 Get MOVE bit again
SL 4 Left shift if in right half
LR 3,A Save partially shifted MOVE bit
LR A,5 Get direction
NI H'1'
BNZ INR2 LF or LB where 4 shift is correct
LR A,3
SL 1 RF and RB require an additional shift
LR 3,A
INR2 LR A,5 Now test fore and aft
NI H'2'
BNZ BOTH
LR A,I Only to increment ISAR
BOTH LR A,5 Now is this a jump or a normal move?
*ISAR points to passive byte if jump else to empty square
NI H'10' Set status for jump bit
BNZ JUMP
JMP NORM It's a normal move
JUMP LR A,S
XS 3 Remove captured piece
LR S,A
LR A,IS
AI H'4' Corresponding king location
LR IS,A
LR A,S Get byte
NS 3 Is the piece a king?
BZ JUM1
XS 3 Remove it
LR S,A
LI -H'3'
BR JU11
JUM1 LI -H'2'
JU11 LR 0,A
LI PASM
LR IS,A
LR A,S
AS 0
LR A,S
LI ISA Back to moved-from location
AS 4 Byte number is in 4
LR IS,A
LR A,5
NI H'2' Test for fore or aft
BZ JUMA Fore move
LR A,D Decrement ISAR (destination always in next byte)
BR JUMB
JUMA LR A,I Increment ISAR
JUMB LR A,IS Save the destination byte #
LR 4,A needed for continuation
LR A,5 Get direction
NI H'1' Test for right or left
LR A,6 Get original piece location
BZ JUM2 0 for R move, ≠0 for L move
SR 1 Left moves involve a right shift of 1
BR JUM3
JUM2 SL 1 Right moves involve a left shift of 1
JUM3 LR 3,A Save bit byte in 3, freeing 6 for other use
LR A,S
XS 3 Set piece down
LR S,A
CLR
AS 2 Was the piece a king?
BZ JUMC No, might be a promotion
CLR
LR 0,A Temporary record of promotion credit
BR JUM6 Already a king so no promotion
JUMC CLR
XS 7 Which side is active
LR A,IS
BZ JUM4 0 if forward
CI O'30' Is this byte 0?
BNZ JUM7 No, so no promotion
LI H'F0' and the king row?
BR JUM5 Promotion indicated, no double jump
JUM4 CI O'33' Is this byte 3?
BNZ JUM7 No, so no promotion
LIS H'F' and the king row?
JUM5 NS 3
BZ JUM7 No
LIS H'1' 1 for promotion
LR 2,A It was 0
LR 0,A Credit for promotion
LR 6,A Used in FIND for no continuation
JUM6 LISU KLOC Get to King position
BR NOM6 MULTIPLE JUMP DEBUGGING BYPASS ----
LR A,S
AS 3 Put down the king
LR S,A
LR A,0
CI H'1' Was there a promotion?
BZ JUM7 No
LI ACTM Yes
LR IS,A
LR A,S
INC Add for promotion
LR S,A
*Now save the board in anticipation of no continuation
JUM7 PI WAST
PI SHOW
LR DC,H (Do not yet advance H)
LI H'10'
ADC
PI SCRA
CLR
XS 0 Should we check for a double jump?
BNZ FORE No, a 1 means a promotion
* Set up conditions to try to find a continuation
LI -H'1'
LR 6,A
LR DC,H
LI H'1C'
ADC
LR A,3
ST Save move bit here for forked multiple
DCI SCOR
LR A,HL
SR 4
SL 1
ADC Points to score for "passed" board
XDC
DCI SCOR
AI -H'4'
ADC Points to score for previous board
LIS H'4'
LR 0,A
JUM8 LM Get score from earlier board
XDC
ST Advance it by 2 boards
XDC
DS 0
BNZ JUM8
DCI MOBS Special flags for double jump case
LR A,HL
SR 4
ADC
CLR Mark passed board with a 0
ST
COM Mark continuation board with -1
ST
LR DC,H Advance H
LI H'20' Copy data two blocks forward
ADC
LR H,DC
LISU PLOC
LISL 0
LIS H'8'
LR 0,A
PI SCRL Active and passive pieces
LISU KLOC
LISL 0
LIS H'4'
LR 0,A
PI SCRL
LR A,I
LR A,3 Continuation from destination
ST
LR A,I
LR A,4 The byte number
SL 1
SL 1
AI H'10' Add jump bit
ST
LR A,I
ST
LR A,I
ST
LI -H'1' Continuation signal
LR 6,A
PI RASC Load scratchpad
LR DC,H
PI EMPT
JMP RFJ Find continuations if any
* If no double jump possible continue here
JUM9 LR DC,H Finally ready to advance H
LI H'10'
ADC
LR H,DC
LR A,7
COM
LR 7,A
*We get here from FIND (with H reset) if no continuation possible
DOUX JMP FIND
* NORM FORE
*Now make normal move
NORM LR DC,H Back in step
CLR
LR 0,A Flag for no promotion
LISU PLOC Get back to Active pieces
LR A,S LISL still OK
AS 3
LR S,A Put in moved piece
LR A,2 Was it a king
NS 2
BNZ NOM6 Yes so don't promote but do put king down
LR A,5
NI H'2' Test for direction
BZ NOM4 Is it going forward?
LR A,IS No
CI H'30' Did it get to the byte 0?
BNZ FORE No
LI H'F0' and in king row?
BR NOM5 Mark for promotion
NOM4 LR A,IS Going forward case
CI H'33' Did it get to byte 3?
BNZ FORE No
LI H'F' and in king row?
NOM5 NS 3
BZ FORE No
LIS H'1'
LR 0,A A promotion flag
NOM6 LISU KLOC Now get to king byte
LR A,S Get corresponding king byte for destination
AS 3 Insert king
LR S,A And replace byte
CLR
AS 0
BZ FORE
LI ACTM Get to active material location
LR IS,A
LR A,S
INC Credit for promotion
LR S,A
FORE LR A,HL Where are we?
CI H'10'
BZ FOR5 Player's move has been made
FOR2 PI SHOW DEBUGGING AID
PI WAST
LR A,7
COM Change color
LR 7,A
LR DC,H GET back in step
LI H'10'
ADC
LR H,DC
PI SCRA Prepare for normal advance
LR A,HL Can we advance score?
SR 4
CI H'2'
BP FOR4 Don't advance score and could be special
AI -H'1' Start at zero
SL 1 Scores take 2 bytes each so *2
DCI SCOR
ADC Current location
XDC
DCI SCOR
AI -H'4'
ADC Get to earlier entry
LM Copy it
XDC
ST
XDC
LM
XDC
ST
LR A,HL Where are we?
CI H'30'
BP FOR4 Still could be special
FOR3 JMP FIND Go forward normally
FOR4 DCI SELX
LR Q,DC
LM
CI H'1'
BM FOR3 Normal play
INC Book or random move has been made
ST so count this as a move
CLR Clear start of PLMV list for
DCI PLMV listing player's possible moves
ST
LR DC,H
XDC
DCI TREE Prepare for TRAN
LR H,DC
LI H'10'
LISU 2
LISL 0
LR S,A
PI TRAN
DCI TREE
LR H,DC
JMP FIND FIND exits to PMOV when HL is H'10'
FOR5 PI BORD Show board after players move
LI H'4' "MY MOVE"
LR 0,A
PI WMC
DCI SCOR Start scores off at H'8000'
LI H'80'
ST
CLR
ST
LI H'80'
ST
CLR
ST
LR A,7
COM Change color
LR 7,A
LR DC,H Advance H
LI H'10'
ADC
LR H,DC
PI SCRA SC to RA with sides reversed
LR DC,H
PI RASC RA to SC preparing for a normal move
DCI SELX
LR Q,DC
LM
INC Add 1 to move count
LR DC,Q
ST
CI H'1'
BZ FOR6 Use stored move
JMP FIND Go find normal reply
FOR6 LISU 2 Get random number
LISL 5
LR A,S
NI H'3' 0 to 3 random number
LR 0,A
SR 1
LR 1,A 0 to 1 random number
LR A,0
NI H'1'
LR 0,A 2nd 0 to 1 random number
* Machine to make 2nd move from book
DCI BKMV Get stored move munber
LM
SL 1 X2, 2 entries for each input move
AS 0 Random choice between them
DCI BOK2 Stored table of book replies
ADC
LM Get reply number
LR 0,A
CLR Use second number to select which half
XS 1
LR A,0
BZ BMV2
SR 4
BMV2 NI H'7'
LR 0,A The final selection
DCI REDM Possible Red moves
BM17 LM Get byte record
LR 1,A
BM18 LR A,1
NS 1
BNZ BM19 Is this byte exhausted?
LM Step over byte info
BR BM17 Go to next byte record
BM19 LR 2,A
AI H'FF' Subtract 1
NS 1
LR 1,A byte less rightmost bit
XS 2 This leaves 1 bit in A
DS 0
BP BM18
LR 6,A Save the byte bit
LM Get the byte info
LR 4,A The byte indicator
LR DC,H
LIS H'C'
ADC
LR A,6
ST
LR A,4
ST
LR DC,H
JMP SELE
*-*-*- Initial moves for red
REDM DC B'00000111' 3 pieces
DC B'00001010' Byte 2, RB
DC B'00001111' 4 pieces
DC B'00001011' Byte 2, LB
DC H'00'
* RASC SCRA FKT STMV
*-*-*- RASC RAM to SC transfer
RASC LR K,P RAM to SC
LISU PLOC ←SC buffer with Active and Passive
LISL 0
RAS2 LM
LR I,A
BR7 RAS2
LM
LR I,A
LISU KLOC
RAS3 LM
LR I,A
BR7 RAS3
LM
LR I,A
PK
* SCRA SC to RAM with side reversal
SCRA LR K,P SC to RAM for side reversal
PI PUSH
LISU PLOC
LISL 4
LIS H'4'
LR 0,A
PI SCRL
LISL 0
LIS H'4'
LR 0,A
PI SCRL
LISU KLOC
LISL 0
LIS H'4'
LR 0,A
PI SCRL
CLR Zero MOVE byte
ST
ST and move info
LR A,I To index only
LR A,I
LR A,I
LR A,D Reverse ACTM and PASM
ST
LR A,D
ST
PI POPS
PK
*
SCRL LR K,P Used by SCRA and SCRD
SCR3 LR A,I
ST
DS 0
BNZ SCR3
PK
*-*-*- Test if Kings only can move
FKT LR K,P
CLR
AS 7
BNZ FK1 Only kings in this direction
FKT2 CLR
XS 3
PK Normal pieces OK
BKT LR K,P
CLR
AS 7 Test sides for backward move
BNZ FK2 NORMAL pieces can move
FK1 LI ISK
AS 4
LR IS,A KINGS only can move
LR A,S
NS 3
LR 3,A
FK2 PK
*Subroutine to add to MOBILITY, and to store MOVE and FLAG bytes if necessary
STMV LR K,P
LR A,HL
SR 4
CI H'01' Is this the player's board
BNZ STM3 No
DCI PLMV Player's moves stored separately
STM0 CLR
XM
BZ STM1 Find empty space
LM Skip info space
BR STM0 Try again
STM1 LI H'FF' Back up
ADC
LR A,3
ST
LR A,4
SL 1
SL 1
AS 5
ST
CLR
ST Store 0 as stop
BR STM2
STM3 CLR
XS 2 To set status byte
BNZ STM2 One is already stored
LR DC,H Get back in step (may not be necessary)
LIS H'C' To get to MOVE byte
ADC
STM4 LR A,3
ST Store MOVE byte in RAM
LR A,4 Get the byte pointer
SL 1
SL 1
AS 5
ST Put this into RAM
LR DC,H May be necessary
STM2 CLR
LR 0,A To accumulate count
LR A,3
STM5 DS 0
AI H'FF'
NS 3 Removes rightmost bit
LR 3,A
BNZ STM5
LR A,0
COM
INC
AS 2 Add in previous count
LR 2,A
PK
* NEXT FIND RFJ LFJ RBJ LBJ
NEXT LR DC,H
LI H'D' Location of earlier byte info
ADC
LM
LR 5,A
NI H'F'
AI H'1'
LR 0,A
CI H'F'
BP NEXA Is this the last byte and direction?
JMP AFT Yes, so back up
NEXA CLR
LR 2,A Used as flag for move found
LIS H'1' Set to 1 for normal back-up
LR 6,A
LI H'FF'
LR 1,A All pieces allowed to move
LR DC,H
LR A,0
SR 1
SR 1
NI H'3'
LR 4,A
CI H'F'
BM NEXJ Jumps required
LR A,0
NI H'3'
BZ NEN0
JMP RBN0
NEN0 JMP RFN
NEXJ LR A,0
NI H'3'
BZ NEJ0
JMP RBJ0
NEJ0 JMP RFJ
* OLD CODE FOLLOWS, NEEDS FIXING FOR MULTIPLE JUMP CASE
LIS H'F' Save only the 4 lower bits
NS 0
LR A,0
CI H'F' Looking for jumps?
BP NEXB No
DCI MOBS It could be a continuation
LR A,HL
SR 4
AI -H'1'
ADC
CLR
XM
BP NEX1 Will be -1 if continuation board
LI -H'1'
LR 6,A Set flag for use in FIND
LR DC,H
LI H'FC' The continuation byte will be here
ADC
LM
LR 1,A Only continuing piece can move
LR A,5
NI H'3'
INC
BNZ NEX0
JMP AFT Must not change byte # if cont.
NEX1 LIS H'1' Set to 1 for normal back-up
LR 6,A
LI H'FF'
LR 1,A All pieces allowed to move
NEX0 LR A,5
AI H'1'
LR 5,A
SR 1
SR 1
NI H'3'
LR 4,A
LR A,5
NI H'10'
BZ RFJ
JMP RBJ0
NEXB LR A,5
SR 1
SR 1
LR 4,A
LR A,5
NI H'3'
BZ NEXC
JMP RBN0
NEXC JMP RFN
*We enter here on going forward
FIND LR DC,H
PI RASC Get board into SC
PI EMPT Compute the empty squares
PI SHOW
PI WAST
CLR
LR 4,A Start with byte 0
LR 2,A Mobility count and move-found flag
LR 6,A So all moves will be found
LI H'FF'
LR 1,A To find all possible jump moves
RFJ LI ISA Active pieces
AS 4 Add byte off-set
LR IS,A Get to byte
LR A,S
NS 1 FF if normal, 1 bit only for continuation
LR 3,A 3 used to develop final byte
PI FKT Any forward moving pieces?
LI ISE+1 Look to empty squares forward
AS 4 Add byte off-set
LR IS,A Destination byte location
LR A,S
SR 1
NS 3
LR 3,A Only pieces that have place to land
LI ISP Passive pieces
AS 4
LR IS,A
LR A,I Look to RF passive pieces forward
SL 4 In front of left-most bits
LR 0,A
LR A,S
SR 4 In front of right-most bits
SR 1
AS 0
NS 3
LR 3,A Pieces that can jump RF
BZ LFJ Were any found?
LI H'10' The RFJ direction and J indicator
LR 5,A
PI STMV Store move byte and info
CLR
AS 6 Recall indicator
BZ LFJ We want all moves
JMP FIN1
LFJ LI ISA
AS 4 Add byte off-set
LR IS,A Get to initial byte
LR A,S
NS 1 FF if normal, 1 bit only for continuation
LR 3,A
PI FKT
LI ISE+1 Empty squares forward
AS 4
LR IS,A
LR A,S
SL 1
NS 3
LR 3,A Only pieces that have a place to land
LI ISP
AS 4
LR IS,A
LR A,I
SL 4
SL 1
LR 0,A
LR A,S
SR 4
AS 0
NS 3
LR 3,A Pieces that can jump LF
BZ RBJ
LI H'11' The LFJ direction and J indicator
LR 5,A
PI STMV
CLR
XS 6
BZ RBJ
JMP FIN1
RBJ0 LR A,5
CI H'2' Which direction, 1, 2, or 3?
BM LBJ It was a 3
BNZ LFJ It was a 1
RBJ LI ISA
AS 4 Add byte off-set
LR IS,A Get to initial byte
LR A,S
NS 1 FF if normal, 1 bit only for continuation
LR 3,A
PI BKT
LI ISE-1 Look to empty squares backward
AS 4
LR IS,A
LR A,S
SR 1
NS 3
LR 3,A
LI ISP-1 Look to passive pieces backward
AS 4
LR IS,A
LR A,I
SL 4
LR 0,A
LR A,S
SR 4
SR 1
AS 0
NS 3
LR 3,A Pieces that can jump RB
BZ LBJ
LI H'12' The RBJ direction and J indicator
LR 5,A
PI STMV
CLR
XS 6
BZ LBJ
JMP FIN1
LBJ LI ISA
AS 4 Add byte off-set
LR IS,A Get to initial byte
LR A,S
NS 1 FF if normal, 1 bit only for continuation
LR 3,A
PI BKT
LI ISE-1 Empty squares backward
AS 4
LR IS,A
LR A,S
SL 1
NS 3
LR 3,A
LI ISP-1 Look to passive pieces backward
AS 4
LR IS,A
LR A,I
SL 4
SL 1
LR 0,A
LR A,S
SR 4
AS 0
NS 3
LR 3,A Pieces that can jump LB
BZ FIN3
LI H'13' The RBJ direction and J indicator
LR 5,A
PI STMV
CLR
XS 6
BZ FIN4 We want them all
FIN1 LR A,HL Jump found, where are we?
SR 4 To get the ply
FIN2 CI H'C' Are we out of space? (next block contains MOBS)
* SET TEMPORARILY LOW TO CHECK FOR TROUBLE, COULD BE AT D
BM FINX To compute non-jump mobility and stop anyway
JMP NOR4 Save mobility and go to SELE
FINX JMP EVAL TEMPORARY SAFETY STOP, SHOULD GO TO RFN
FIN3 CLR
XS 6
BM FIN9 Continuation case
FIN4 LR A,4 Go to next board byte
INC
NI H'3'
LR 4,A
BZ FIN5 There are no more
JMP RFJ Go round again for next byte
FIN5 CLR
XS 6
BZ FIN6
JMP AFT No more jumps
FIN6 CLR
XS 2 Have any jumps been found?
BNZ FIN7 Yes
JMP RFN Check on normal moves
FIN7 LR A,HL
SR 4
CI H'1'
BNZ FIN8
JMP PMOV
FIN8 JMP SELE
*
FIN9 LR DC,H There was no continuation
LI H'F0' Back up
ADC
LR H,DC
JMP DOUX This changes the color and proceeds
*We compare the score with that 2 blocks earlier and back it up if greater
*and then back to this level in any case
AFTC LR DC,H We are here
LIS H'E' Get score values
ADC
LM
LR 0,A Save them to complare
LM
LR 1,A
LI H'D0' Actually backing only 2
ADC
LR H,DC We back up always
LIS H'E' Get to score location
ADC
LR A,0 Now compare score
CM
BM AFT2 Back score for sure
BNZ AFT5 Do not back score
LR A,1 A further comparison is necessary
CM
BP AFT5 Do not back after all
AFT2 LR DC,H Resetting is easier
LIS H'E'
ADC
LR A,0 Back up the score
ST
LR A,1
ST
LR A,HL Where are we?
SR 4
CI H'3' Do we need to save board as possible move?
BNZ AFT5 No, at some other level in the tree
LR A,0 Invert score for compaarison
COM
INC
LR 0,A
LR A,1 Invert score
COM
INC
LR 1,A
LR DC,H
LI H'FE' Back to earlies score
ADC
LR A,0
CM
BM AFT3 Board should be saved
BNZ AFT5 It should not be saved
LR A,1
CM
BP AFT5 Don't save after all
*Special treatment is necessary to prevent the saving of the
*intermediate board position of the multiple jump at a later time
*We do this by backing the score now
AFT3 LR DC,H
LI H'FE'
ADC
LR A,0 First back score now
ST
LR A,1
ST
DCI TREE Location to save board
XDC
*NOTE: This is fixed for a double jump but some additional code
*may still needed for a triple jump!
LR DC,H
LI H'10' Double jump resulting board
ADC
LR 0,A Counter
AFT4 LM Now save the board
XDC
ST
XDC
DS 0
BNZ AFT4
AFT5 JMP SELE
* AFT MAKE RFN LFN RBN LBN NORT NORF NOR2 NOR3 NOR4
*No moves found so time to back up
AFT LR DC,H Get current board's score
LR A,HL
SR 4
AI -H'1'
SL 1 2 bytes per entry
DCI SCOR
ADC
LR Q,DC We'll use this as reference point
LM
LR 0,A The current material advantage term
LM
LR 6,A The current positional term
LR A,HL
SR 4
* TEMPORARY BYPASS
CI H'2'
BZ MAKE
BR AFF2
* NORMAL CODE CONTINUES HERE
AI -H'2'
DCI MOBS Flags may be stored here
ADC
CLR
XM
BM AFTB Backing into double jump
BNZ AFTA Not a continuation board
JMP AFTC At continuation board now
AFTA LR A,HL Where are we?
SR 4
CI H'3'
BM AFF1 Could alpha beta prune
BZ AFF2 Can't alpha beta prune
JMP MAKE Time to report move
AFTB BR AFF2 TEMPORARY FIX ONLY
AFF1 LR DC,Q
LI -H'4' 2 levels earlier
ADC
LR Q,DC
LR A,0
CM
BM AFF2 Can not alpha-beta prune
BNZ AFF3 Can prune
* First terms are equal so test second byte
LR A,6
CM
BM AFF3 Can prune
* Cannot prune so compare score with one level back
AFF2 LR DC,Q
LIS H'2'
ADC
LR Q,DC
LR A,6 Change sign of score terms
COM
INC
LR 6,A
LR A,0
COM
INC
LR 0,A
CM
BM AFF4 Back score for sure
BNZ AFF5 Do not back score
LR A,6 Must test second bytes
CM
BP AFF5 Do not back scores
AFF4 LR DC,Q
LR A,0
ST
LR A,6
ST
AFF5 PI SHOW
PI WAST
LR A,7
COM
LR 7,A
LR DC,H
LI H'F0'
AFF6 ADC
LR H,DC
PI RASC
LR DC,H
PI EMPT
LIS H'1'
LR 6,A
JMP SELE
AFF3 LR DC,H
LI H'E0'
BR AFF6
*Prepare for analysis of player's reply
MAKE DCI PLMV This space is also used by TREE routine
CLR
ST
DCI TREE Get to players board
LR H,DC
JMP FIND
*
RFN LI ISA
AS 4 Add byte off-set
LR IS,A Get to initial byte
LR A,S
LR 3,A
PI FKT
BZ RBN
LI ISE Start of empty region
AS 4 Add off-set
LR IS,A
LR A,I Look to RF empty squares
SL 4
LR 0,A
LR A,S
SR 4
SR 1
AS 0
NS 3
LR 3,A Pieces that can move RF
BZ LFN
CLR
LR 5,A
PI STMV
CLR
XS 6
BZ LFN
JMP NORF
LFN LI ISA
AS 4 Add byte off-set
LR IS,A Get to initial byte
LR A,S
LR 3,A
PI FKT
BZ RBN
LI ISE Start of empty region
AS 4 Add off-set
LR IS,A
LR A,I Look to LF empty squares
SL 4
SL 1
LR 0,A
LR A,S
SR 4
AS 0
NS 3
LR 3,A Pieces that can move LF
BZ RBN
LIS H'1'
LR 5,A
PI STMV
CLR
XS 6
BZ RBN
JMP NORF
RBN0 LR A,5
CI H'2' Which direction, 1, 2, or 3?
BM LBN It was a 3
BNZ LFN It was a 1
RBN LI ISA
AS 4 Add byte off-set
LR IS,A Get to initial byte
LR A,S
LR 3,A
PI BKT
BZ NORT
LI ISE-1
AS 4 Add off-set
LR IS,A
LR A,I Look to RB empty squares
SL 4
LR 0,A
LR A,S
SR 4
SR 1
AS 0
NS 3
LR 3,A Pieces that can move RB
BZ LBN
LIS H'2'
LR 5,A
PI STMV
CLR
XS 6
BZ LBN
JMP NORF
LBN LI ISA
AS 4 Add byte off-set
LR IS,A Get to initial byte
LR A,S
LR 3,A
PI BKT
BZ NORT
LI ISE-1
AS 4 Add off-set
LR IS,A
LR A,I Look to LB empty squares
SL 4
SL 1
LR 0,A
LR A,S
SR 4
AS 0
NS 3
LR 3,A Pieces that can move LB
BZ NORT
LIS H'3'
LR 5,A
PI STMV
CLR
XS 6
BZ NORT
NORF JMP SELE
*We get here if we want to compute mobility and also if no moves found
NORT LR A,4
INC
NI H'3'
LR 4,A
BZ NOR0
JMP RFN Go round again for next byte
NOR0 CLR
XS 2 Get mobility count
BNZ NOR1
JMP AFT Woops! no move found
NOR1 LR A,HL Where are we?
SR 4 Get Ply number
AI -H'1'
BNZ NOR2 Checking for possible player's moves?
PI BORD Put up board for player
JMP PMOV Yes, so let him move
NOR2 DCI PLY0 Player's choice of ply
AM
LR DC,H Reset DC
BM NOR4 Go on in this case
BNZ NOR3 Stop for sure
LI H'F5' Decision based on previous move
ADC
LM
NI H'10' Test jump flag
LR DC,H
BNZ NOR4 Go on if previous move was a jump
NOR3 JMP EVAL
NOR4 LR A,HL
SR 4
AI -H'1'
DCI MOBS
ADC
LR A,2
ST Save mobility in MOBS space indexed by ply
NOR7 JMP SELE
* EVAL
EVAL LI ACTM Compute the material advantage term
LR IS,A
LR A,I
LR 0,A ACTM
LR A,I
LR 2,A PASM
COM
INC
AS 0
LR 3,A ACTM-PASM
BP EVA1
COM
INC
EVA1 LR 1,A |A-P|
LR A,0
AS 2
COM
INC
AI H'30' Add 48
LR 2,A 48-A-P
PI MPYR Returns product in 0
CLR
XS 3 To get sign
LR A,0
BP EVA2
COM
INC
LR 0,A Material advantage with sign
EVA2 LR A,HL We'll need the ply value
SR 4
AI -H'1'
LR 5,A We'll need it again
DCI SCOR
SL 1 2 bytes per entry
ADC Score from 2 earlier had been advanced
LR Q,DC We'll need this again
LR A,0 Get materil adv. term
CM Is current value smaller?
BM EVA5 No, we cannot alpha-beta prune
BNZ EV12 Yes, we can prune at once
PI MOBG Get mobility term
CLR
XS 6 To get its sign
LR A,5 Get ply value
BP EVA3 Test sign of Mobility term
COM If neg. we add H'10'-M
INC
AI H'10'
BR EVA4
EVA3 AI -H'10' If pos. we add M-H'10'
EVA4 AS 6 Add it in
CM Compare it with stored value
BP EV12 We can prune after all
BR EVA9
EVA5 PI MOBG We assume that this will be needed
CLR
XS 0
BNZ EVA6
CLR
XS 6
EVA6 LR A,5 Get ply value
BP EVA7 Test sign of MATL term
COM If neg. we add H'10'-M
INC
AI H'10'
BR EVAZ
EVA7 AI -H'10' If pos. we add M-H'10'
EVAZ AS 6 Add it in
LR 6,A The final positional term
EVA9 LR DC,Q Get back to first byte
LI -H'2' and 1 ply earlier
ADC
LR A,0 Get material adv term again
COM Reverse for normal compare and back-up
INC
LR 0,A Save in reversed form
CM
BM EV10 We can back score
BNZ EV11 do not back score
*Again we must compare second bytes
LR A,6
COM
INC
LR 6,A
CM
BM EV10 Must back score
BR EV11 Do not back score
EV10 LR DC,Q Back score
LI -H'2' 2 bytes per entry
ADC
LR A,0
ST
LR A,6
ST
EV11 LR DC,H Now back up
LI H'F0'
ADC
LR H,DC
LR A,7
COM
LR 7,A
BR EV13
EV12 LR DC,H Alpha beta prune
LI H'E0' Back 2
ADC
LR H,DC
EV13 LIS H'1'
LR 6,A
JMP SELE
MOBG LR K,P To compute mobility term
DCI MOBS
LR A,5 Get back the ply value
AI -H'1' We want earlier value
ADC
LM Get earlier mobility
COM
INC
AS 2 Add current mobility
CI H'7' Difference limited to absolute 7
BP MOB2
LIS H'7'
MOB2 CI -H'7'
BM MOB3
LI -H'7'
MOB3 SL 4 Make room for ply term
LR 6,A Save difference (and free 2)
PK
* EMPT CAQ MPYR WAST
EMPT LR K,P Empty squares in O'51' thru O'54'
LISU ELOC with guard bytes in 50 and 55
LISL 0
CLR
LR S,A Make sure guard byte is empty
LISU PLOC Start with ACTIVE
LIS H'4'
LR 0,A
BR EMP3
EMP2 LR A,IS
AI H'30' Actually subtracting 16
LR IS,A
EMP3 LR A,S
LR 1,A
LR A,IS
AI 4
LR IS,A
LR A,S
AS 1
LR 1,A
LR A,IS
AI H'D' Add 13 get to the correct EMPTY locat
LR IS,A
LR A,1
COM Reverse 1's and 0's
LR S,A
DS 0
BNZ EMP2
LR A,I To index only
CLR
LR S,A Upper guard byte
PK
*-*-*-*-*-*-*-*-*-*
CAQ LR K,P To add count of bits in 0 to count in 1
LR A,0
BZ CAQ4
CAQ2 DS 1
AI H'FF'
NS 0
LR 0,A
CAQ3 BNZ CAQ2
CAQ4 PK
*-*-*-*-
MPYR LR K,P Multiplies larger pos. number in 2
CLR by smaller pos. # in 1
LR 0,A Product into 0
LR A,1
MPY1 NI H'1' Is the rightmost bit a 1?
BZ MPY2 No
LR A,2
AS 0
LR 0,A
MPY2 LR A,2
SL 1
LR 2,A
LR A,1
SR 1
LR 1,A
BNZ MPY1 Product is not complete
PK
*-*-*-
*First replies (maximum of 4 each)
BOK2 DC H'33' 24,20 24-20 To 12-16
DC H'33' 24-20, 24-20
DC H'43' 23-19, 24-20 To 11-15
DC H'20' 22-17, 24-19
DC H'22' 22-17, 22-17 To 10-14
DC H'22' 22-17, 22-17
DC H'55' 22-18, 22-18 To 9-13
DC H'55' 22-18, 22-18
DC H'31' 24-20, 23-18 To 11-16
DC H'45' 24-19, 22-18
DC H'66' 21-17, 21-17 To 10-15
DC H'66' 21-17, 21-17
DC H'55' 22-18, 22-18 To 9-14
DC H'55' 22-18, 22-18
*-*-*-
WAST LR K,P Delay loop to WASTE some time
LIS H'1' Should be about 2 sec.
LR 0,A
WAS2 CLR
LR 1,A
WAS3 CLR
LR 2,A
WAS4 DS 2
BNZ WAS4
DS 1
BNZ WAS3
DS 0
BNZ WAS2
PK
*
PAT1 DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
DC 0
END
*-*-*-
*First counter replies (maximum of 2 each)
*NOTE This table will not work as there are 28 possible third move
*nombers that have to be stored and this will take a complete byte for each
*thus requiring 98 bytes for this table.
*
BOK3 DC To 12-16 24-19
DC To 12-16 23-18
DC To 12-16 22-17
DC H'00' 8-12, 8,12 To 12-16 24-20
DC H'00' 16-23, 16,23 To 12-16 23-19
DC To 12-16 22-18
DC To 12-16 21-17
DC H'00' 15-24, 15-24 To 11-15 24-19
DC H'00' 8-11, 8-11 To 11-15 23-18
DC H'60 9-13, 8-11 To 11-15 22-17
DC H'00' 8-11, 8-11 To 11-15 24-20
DC H'05 8-11, 9-14 To 11-15 23-19
DC H'00' 15-22, 15-22 To 11-15 22-18
DC To 11-15 21-17
*-*- THERE WILL BE 49 BYTES OF THESE, EACH WITH 2 COUNTER REPLIES
*-*- The ones listed at present are from Lee's Guide
* END